package ohtu;

import java.io.Serializable;
import java.util.Calendar;

public class Event implements Serializable {

	private String name,
		info,
		location;
	private Calendar startDate;
	private int duration;
	private boolean recurring;
	private Course course;

	public Event(String name, Calendar startDate,
		int duration,
		boolean regular, String info, String location, Course course) {
		this.name = name;
		this.startDate = startDate;
		this.duration = duration;
		this.recurring = regular;
		this.location = location;
		this.info = info;
		this.course = course;
	}

	public String getLocation()
	{
		return this.location;
	}
	public String getName() {
		return this.name;
	}

	public String getInformation()
	{
		return this.info;
	}

	public Calendar getStartDate() {
		return this.startDate;
	}

	public int getDuration() {
		return this.duration;
	}

	public boolean isRecurring() {
		return this.recurring;
	}

	public void setName(String newname) {
		this.name = newname;
	}

	public void setStartDate(Calendar newtime) {
		this.startDate = newtime;
	}

	public void setDuration(int newduration) {
		this.duration = newduration;
	}

	public void setRegular(boolean x) {
		this.recurring = x;
	}

	public void setInfo(String s) {
		info = s;
	}

	@Override
	public String toString() {
		return name;
	}

	public String getInfo() {
		String ret;
		if (course == null) {
			ret = name + "\n==========\n" + location + "\n\nHUOMIOITAVAA:\n=============\n" + info;
		} else {
			ret = name + "  (" + course + ")\n==========\n" + location + "\n\nHUOMIOITAVAA:\n=============\n" + info;
		}
		return ret;
	}

	Course getCourse() {
		return course;
	}
}
